<!-- slide start -->
<div id="slide" class="slide">
    <ul>
        <tag:houseSlide id="vo">
            <li><a href="javascript:void(0)"><img src="{$vo.img}"></a></li>
        </tag:houseSlide>
    </ul>
</div>
<script>
    GH.load("js", "js-slide", "__COMMON__/js/slide.js", function(){
        utuoSlide("slide");
    });
</script>
<!-- slide end -->
<div class="container pd10">
	<div class="section">
    <header>
        {$house.name}
    </header>
    <article>
        <div class="house-type-list" id="house-type-list">
            <ul>
                <tag:houseType id="vo">
                    <li><a href="javascript:void(0)"><strong>{$vo.name}</strong>
                            <p>
                                {$vo.description}
                            </p>
                            <i class="arrows"></i></a></li>
                    <div class="house-photo clearfix">
                        <a href="{$vo.url}">户型图</a>
                        <a href="{:U('House/scene','sid='.$sid.'&type='.$vo['id'])}">全景图</a>
                    </div>
                </tag:houseType>
            </ul>
        </div>
    </article>
	</div>
</div>
<script type="text/javascript">
    (function(){
    
        window.onload = function(){
            var houseType = document.getElementById("house-type-list"), houseTypeList = document.querySelectorAll("#house-type-list a");
            delegate("click", houseType, "li", function(){
                var className = this.getAttribute("class") || "", reg = new RegExp(/(^| )current( |$)/);
                if (reg.test(className)) {
                    this.className = className.replace(reg, "");
                }
                else {
                    this.className = className + " current";
                }
            })
        }
        
        //事件代理
        function delegate(type, obj, target, callback){
            obj.addEventListener("click", fun, false);
            function fun(e){
                var p = e.target;
                while (p) {
                    if (p.nodeName.toLowerCase() === target.toLowerCase()) {
                        callback && callback.apply(p);
                    }
                    p = p.parentNode;
                }
            }
        }
        
    })()
</script>
